package com.tongjie.hotelbooking.order.service;

import com.tongjie.hotelbooking.order.entity.Order;
import com.tongjie.hotelbooking.order.entity.OrderConsulting;
import com.tongjie.hotelbooking.order.repository.OrderConsultingRepository;
import com.tongjie.hotelbooking.user.entity.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class OrderConsultingService {

    @Resource
    private OrderConsultingRepository orderConsultingRepository;

    public int countOrderConsultingByOrder(Order order) {
        return this.orderConsultingRepository.countOrderConsultingByOrder(order);
    }

    public OrderConsulting getOrderConsultingByOrderIdAndMerchantId(Long orderId, Long merchantId) {
        return this.orderConsultingRepository.getOrderConsultingByOrderAndMerchant(Order.builder().id(orderId).build(), User.builder().id(merchantId).build());
    }




}
